import { globalRouteGuard } from "@/utils/auth";

Page({
  onLoad() {
    // 使用全局路由守卫检查登录状态
    if (!globalRouteGuard('/pages/index/index')) {
      return;
    }
  },
  onPullDownRefresh() {
    console.log('下拉刷新');
    // 获取 BookGrid 组件实例并调用其方法
    const bookGrid = this.selectComponent('#bookGrid');
    if (bookGrid) {
      bookGrid.reloadBooks();
    } else {
      wx.stopPullDownRefresh();
    }
  }
// onReachBottom() {
//   console.log('onReachBottom triggered'); // 添加日志
//   const bookGrid = this.selectComponent('#bookGrid');
//   if (bookGrid && bookGrid.data.hasMore && !bookGrid.data.loading) {
//     bookGrid.handleReachBottom();
//   }
// }

})